<?php
//前台首页
class indexMod extends commonMod
{
	public function __construct()
	{
		parent::__construct();

	}
	//首页
	public function index()
	{		
		$this->display();
	}
	public function add() {
	//添加
		$record = $_POST;
		$record['add_time']=date(YmdHis);
		foreach($record as $value){
		if (empty($value)) {
			
			return false;
		}
		}
		//print_r($record);
		$isOK=$this->model->table('record')->data($record)->insert(); 
		if ($isOK) {
		header("Content-type: text/html");
			echo "<tr><td>$record[date]</td><td>$record[cat]</td><td>$record[card]</td><td>$record[fee]</td><td>$record[detail]</td><td>$record[where]</td><td>$record[who]</td></tr>";

		}
		//$userExist=$this->model->table('qc_user')->where($condition)->find(); 
	}
	public function show($num) {
	//显示列表
	
	$list=$this->model->table('record')->where($condition)->order('date desc')->limit($num)->select(); 
	header("Content-type: text/html");
	foreach ($list as $record ){
	echo "<tr><td>$record[date]</td><td>$record[cat]</td><td>$record[card]</td><td>$record[fee]</td><td>$record[detail]</td><td>$record[where]</td><td>$record[who]</td></tr>";

	}

	}

}
?>